package com.zmj.sy.mom.srv.aps.controller;



import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.zmj.sy.mom.srv.aps.bean.dto.workReport.ReportDetailDto;
import com.zmj.sy.mom.srv.aps.bean.vo.base.Result;
import com.zmj.sy.mom.srv.aps.bean.vo.workReport.ReportDetailVo;
import com.zmj.sy.mom.srv.aps.service.WorkReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Slf4j
@RequiredArgsConstructor
@Api(tags = "报工记录")
@RestController
@RequestMapping("/workReport")
public class WorkReportController {

    private final WorkReportService workReportService;

    /**
     * @Description: 报工记录明细数据
     *
     * @author: hejiahui
     * @since: 2024/10/22 16:23
     */
    @ApiOperation(value = "1.0 报工记录明细数据")
    @GetMapping(value = "/getReportDetail")
    @ApiOperationSupport(order = 13)
    public Result<IPage<ReportDetailVo>> getReportDetail(ReportDetailDto reportDetailDto){
        Result<IPage<ReportDetailVo>> result = Result.success();
        try {
            result = workReportService.getReportDetail(reportDetailDto);
            return result;
        } catch (Exception e) {
            result = Result.error(e.getMessage());
            return result;
        }
    }
    /**
     * @Description: 报工记录汇总数据
     *
     * @author: hejiahui
     * @since: 2024/10/23 8:06
     */
    @ApiOperation(value = "1.1 报工记录汇总数据")
    @GetMapping(value = "/getReportMerge")
    @ApiOperationSupport(order = 14)
    public Result<IPage<ReportDetailVo>> getReportMerge(ReportDetailDto reportDetailDto){
        Result<IPage<ReportDetailVo>> result = Result.success();
        try {
            result = workReportService.getReportMerge(reportDetailDto);
            return result;
        } catch (Exception e) {
            result = Result.error(e.getMessage());
            return result;
        }
    }
}

